package m.jclecai.com.adapter;

import android.content.Context;
import android.view.ViewGroup;
import com.alibaba.fastjson.JSONObject;
import m.jclecai.com.R;

import java.util.List;

import m.jclecai.com.adapter.base.ViewHolerAdapter;
import m.jclecai.com.adapter.holder.BonusOptimizationHolder;
import m.jclecai.com.listener.Callback;

/**
 * Created by ZD on 2017/5/10.
 */

public class BonusOptimizationAdapter extends ViewHolerAdapter<BonusOptimizationHolder> {
    Context mContext;
    List<JSONObject> result, match;
    Callback changed;

    public BonusOptimizationAdapter(Context context, List<JSONObject> result, List<JSONObject> match,Callback changed) {
        mContext = context;
        this.result = result;
        this.match = match;
        this.changed = changed;
    }

    @Override
    public BonusOptimizationHolder onCreateViewHolder(int position, ViewGroup parent) {
        return new BonusOptimizationHolder(mContext, R.layout.item_bonus_optimiza);
    }

    @Override
    public void onBindViewHolder(int position, BonusOptimizationHolder bonusOptimizationHolder) {
        bonusOptimizationHolder.init(result.get(position),changed,match,position);
    }

    @Override
    public int getCount() {
        return result.size();
    }
}
